package com.autoMobile.servlet;

import com.autoMobile.bean.ddmUser;
import com.autoMobile.dao.ddmUserDao;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;




@WebServlet("/ddm/addServlet")
public class addServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
   
    public addServlet() {
        
    }

	
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
	this.doPost(request, response);
	}

	
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		request.setCharacterEncoding("UTF-8");
		String uname=request.getParameter("username");
		String upass=request.getParameter("password");
		String st=request.getParameter("stime");
		String ot=request.getParameter("otime");
		String us=request.getParameter("shiyong");
		String mess=request.getParameter("message");
		ddmUser user =new ddmUser(1,uname,upass," ",st,ot,us,mess);
		ddmUserDao dao=new ddmUserDao();
		dao.addUser(user);
		response.sendRedirect(request.getContextPath()+"/employee/Userchakan.jsp");
	}

}
